package com.hxx.day4;

import org.junit.Test;

public class TestDemo2 {
    public static void main(String[] args) {//创建数组
        //创建静态数组
        int[] arr = new int[]{1,2,3,4,5};
        int arr1[] = {1,2,3,4,5};

        //创建动态数组
        int[] arr2 = new int[5];
        String[] arr3 = new String[5];
    }

    @Test
    public void test1() {//循环获取元素
        int[] arr = new int[]{1,2,3,4,5};
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
    @Test
    public void test2() {//添加元素
        int[] arr = new int[3];
        arr[0] = 1;
        arr[1] = 2;
        arr[2] = 3;
    }
}
































